package com.fancy.learncenter.ui.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.fancy.learncenter.R;
import com.fancy.learncenter.bean.ListStudentDataBean;
import com.fancy.learncenter.ui.activity.EditStudentActivity;
import com.fancy.learncenter.ui.adapter.base.CommonRecycleViewAdapter;
import com.fancy.learncenter.ui.adapter.base.CustomViewHold;

import java.util.List;

/**
 * Created by hyy on 2018/1/25.
 * describe as
 */

public class CartoonStudentAdapter extends CommonRecycleViewAdapter<ListStudentDataBean.StudentsBean> {
    public CartoonStudentAdapter(Context mContext, List<ListStudentDataBean.StudentsBean> itemDatas, String classId) {
        super(mContext, R.layout.activity_cartoon_student_item, itemDatas);
        this.classId = classId;

    }

    String classId;
    @Override
    public void bindView(CustomViewHold customViewHold, final ListStudentDataBean.StudentsBean item, int position) {


        TextView name = customViewHold.getView(R.id.name);
        name.setText(item.getName());

        SimpleDraweeView simpleDraweeView = customViewHold.getView(R.id.simpleDraweeView);
        simpleDraweeView.setImageURI(item.getImageUrl());


        customViewHold.getRoorView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(mContext, EditStudentActivity.class);
                intent.putExtra(EditStudentActivity.STUDENT_KEY, item);
                intent.putExtra("classId", classId);
                mContext.startActivity(intent);
            }
        });

    }
}
